<template>
  <label class="m-checkbox" :for="label" :class="{disabled: disabled}">
    <input type="checkbox" 
      v-model="model"
      :name="name"
      :id="label"
      :value="result"
      :disabled="disabled"
      @change="onChange">
    <span class="check-btn"></span>
    <slot></slot> 
  </label> 
</template>

<script>
  export default {
    props: {
      label: {
        type: [String, Number],
        default: ''
      },
      result: [Object, Array, String, Number],
      name: {
        type: String,
        deufult: null
      },
      disabled: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {
        model: []
      }
    },
    methods: {
      onChange() {
        this.$parent.change(this.model)
      }
    }
  }
</script>

<style lang="scss" scoped>
  @import '../../scss/_checkbox.scss';
</style>